
var carTypeName = ['小客车','大客车','中形货车','大形货车','危险品车']
var carTypeColor = ['#22A45D','#FF7552','#2DF3FF','#704FE6','#FFB619']
var carTypeValue = [2200,2000,1500,1000,2500]  
var getMax = 2500; //最大值
let chewdtOpt = {
    legend: {
		orient: 'vertical',
        top: 'center',
        icon:'diamond',
        right: 0,
		data: carTypeName,
		itemHeight: 12,
		itemWidth: 12
	  },
    tooltip: {
    	trigger: 'item',
    	formatter: "{b} : {c} ({d}%)"
    },
    color: carTypeColor,
    title: {
        text: '{a|' + getMax + '}\n{c|' + '总车流' + '}',
        x: '15%',
        y: 'center',
        textStyle: {
            rich: {
                a: {
                    fontSize: 30,
                    color: '#000'
                },
               c: {
                    fontSize: 16,
                    color: '#000',
                    padding: [7, 7],
                },
            },
        },
    },
    series: [
        {
        
            type: 'pie',
            center: ['33%', '50%'],//左右 高低
            radius: ['50%', '60%'],
            label: {
                show: false,
            },
            data: [
                {
                    value: carTypeValue[0],
                    name: carTypeName[0]
                },
                {
                    value: carTypeValue[1],
                    name: carTypeName[1]
                },
                {
                    value: carTypeValue[2],
                    name: carTypeName[2]
                },
                {
                    value: carTypeValue[3],
                    name: carTypeName[3]
                },
                {
                    value: carTypeValue[4],
                    name: carTypeName[5]
                }
            ],
        }
    ],
};
var chewdtChart = echarts.init(document.getElementById('chewdt_1'));
chewdtChart.setOption(chewdtOpt)



var carTypeName2 = ['占用','空闲','异常']
var carTypeColor2 = ['#2DF3FF','#22A45D','#FF7552'];
var carTypeValue2 = [500,200,100]
var getMax2 = 764;

let chewdt2Opt = {
    legend: {
		orient: 'vertical',
        top: 'center',
        icon:'diamond',
        right: 10,
		data: carTypeName2,
		itemHeight: 12,
		itemWidth: 12
	  },
    // backgroundColor: '#131D25',
    color: carTypeColor2,
	tooltip: {
		trigger: 'item',
		formatter: "{b} : {c} ({d}%)"
	},
    title: {
        text: '{a|' + getMax2 + '}\n{c|' + '总车位' + '}',
        x: '30%',
        y: 'center',
        textStyle: {
            rich: {
                a: {
                    fontSize: 30,
                    color: '#000'
                },
               c: {
                    fontSize: 16,
                    color: '#000',
                    padding: [7, 0],
                },
            },
        },
    },
    series: [
        {
        
            type: 'pie',
            center: ['43%', '50%'],//左右 高低
            radius: ['50%', '60%'],
            label: {
                show: false,
            },
            data: [
                {
                    value: carTypeValue2[0],
                    name: carTypeName2[0]
                },
                {
                    value: carTypeValue2[1],
                    name: carTypeName2[1]
                },
                {
                    value: carTypeValue2[2],
                    name: carTypeName2[2]
                }
            ],
        }
    ],
};
chewdt2Chart = echarts.init(document.getElementById('chewdt_2'));
chewdt2Chart.setOption(chewdt2Opt)
